import axios from "axios";
import { message } from 'antd';
import router from '../router';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';

// 请求拦截器
axios.interceptors.request.use(function (config) {
    const global=localStorage.getItem("userName")
    config.headers.Authorization=global
    return config;
});



//响应拦截器
  axios.interceptors.response.use(
    response => {
        if(response.status == 200){
            return Promise.resolve(response.data);
        }else{
            return Promise.reject(response.data.m);
        }
    });

  export default axios